<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/commonEdit.jsp"%>
<%@ include file="/commons/validation.jsp"%>
<%@ include file="/commons/dateTime.jsp" %>
<%@ include file="/commons/fileUpload.jsp" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>出入证新增</title>
<script type="text/javascript" src="${ctx }/scripts/public3.js"></script>
<script type="text/javascript" src="${ctx}/scripts/public.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common/prototype.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/div/common.js"></script>
<script type="text/javascript" src="${ctx}/scripts/ajaxException.js"></script>
<script type="text/javascript">

	function setButtonStatus(status){ //设置按钮状态 true 代表可用 false代表不可用
		$("btn1_22").disabled = !status;
		$("btn1_32").disabled = !status;
	}

	function saveWin(){
		if($('keyword').value == "" && $('state_0').checked == true){
			windowClose();
			return ;
		}

		var isTrue=$("receiptForm").fireEvent("onSubmit");
  		if(isTrue){
  			setButtonStatus(false);
			var params = $("receiptForm").serialize();
			var url = "${ctx}/charge_chargeVoucherPrintAction.do?method=regeditReceipt";
			sendAjaxRequest(url,params,function(response){

				setButtonStatus(true);
				ajaxSubmitException(response.responseText);
				findFrame('main').refleshPage(); //刷新主页面列表
				windowClose();
			});
		}
	}

	function setState(status){
		$("receiptName").disabled = !status;
		$("receiptDate").disabled = !status;
		$("imgReceiptDate").disabled = !status;
		$("remark").disabled = !status;
	}
</script>

</head>

<body >
<form id="receiptForm" name="receiptForm" method="post" action=""  class="required-validate" >
	<input type="hidden" id="voucherId" name="voucherId" value="${voucherId}" >
	<input type="hidden" id="keyword" name="keyword" value="${receiptVO.keyword}">
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
	  <tr>
	    <td class="window_head_outBg">
	    <table border="0" cellpadding="0" cellspacing="0">
		      <tr><td><img src="${ctx}/images/ico_Advance.gif" width="16" height="16" align="absmiddle" /> <span class="window_head_intext">记录开票</span></td></tr>
	    </table>
	    </td>
	  </tr>
	  <tr><td class="aux_header_line_1"></td></tr>
	  <tr><td class="aux_header_line_2"></td></tr>
	  <tr>
	    <td class="content">

		<table width="100%" border="0" cellspacing="0" cellpadding="0">
	      <tr>
	        <td class="aux_outtable_color">
	        <table width="100%" border="0" cellpadding="0" cellspacing="1" class="aux_intable_color">
	            <tr>
	              <td class="aux_intable_td1">是否开发票：</td>
	              <td class="aux_intable_td2">
	              	<input type="radio" id="state_1" name="state" value="1" onclick="setState(true);" checked="checked"/>是&nbsp;&nbsp;&nbsp;&nbsp;
	              	<input type="radio" id="state_0" name="state" value="0" onclick="setState(false);"  />否</td>
	              </tr>
	            <tr>
	              <td class="aux_intable_td1">发票号：</td>
	              <td class="aux_intable_td2"><input name="receiptName" id="receiptName" type="text" class="inputtext validate-char max-length-50" validateChar="$"  size="16" value="${receiptVO.receiptName }" /></td>
	              </tr>
	            <tr>
	              <td class="aux_intable_td1">时 间：</td>
	              <td class="aux_intable_td2">
						<input name="receiptDate" id="receiptDate"  type="text" class="inputtext validate-date"  size="16" afterInsert="receiptDateSpan" value="<fmt:formatDate pattern='yyyy-MM-dd' value='${receiptVO.receiptDate }'/>" />
						<img id="imgReceiptDate" name="imgReceiptDate" src="${ctx}/images/ico_clock_month.gif" width="20" height="20" /><span id="receiptDateSpan"></span>
	              </td>
	              </tr>
				<tr>
	              <td class="aux_intable_td1">备 注：</td>
	              <td class="aux_intable_td2">
	               	<textarea id="remark" name="remark" rows="3" cols="20" class="validate-char max-length-300" validateChar="$" >${receiptVO.remark }</textarea>
	              </td>
	              </tr>

	          </table>
	        </td>
	      </tr>
	    </table>

		</td>
	  </tr>
	  <tr>
	    <td class="window_footer"><table border="0" cellspacing="0" cellpadding="0">
	      <tr>
	        <td class="btn_between_space">&nbsp;</td>
	        <td><table border="0" cellpadding="0" cellspacing="0">
	            <tr>
	              <td class="buttonOffLeft" id="btn1_21"></td>
	              <td class="buttonOffMiddle" id="btn1_22" onClick="saveWin();" onMouseOver="btn_change_over(2)" onMouseOut="btn_change_out(2)" onBlur="btn_change(2)"><img src="${ctx}/images/ico_ok.gif" alt="" width="14" height="14" border="0" align="absbottom" /> 保 存</td>
	              <td class="buttonOffRight" id="btn1_23"></td>
	            </tr>
	        </table></td>
	        <td class="btn_between_space"></td>
	        <td><table border="0" cellpadding="0" cellspacing="0">
	            <tr>
	              <td class="buttonOffLeft" id="btn1_31"></td>
	              <td class="buttonOffMiddle" id="btn1_32" onClick="windowClose();" onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)" onBlur="btn_change(3)"><img src="${ctx}/images/ico_cancel.gif" alt="" width="14" height="14" border="0" align="absbottom" /> 关 闭</td>
	              <td class="buttonOffRight" id="btn1_33"></td>
	            </tr>
	        </table></td>
	      </tr>
	    </table></td>
	  </tr>
	</table>
</form>

<script type="text/javascript">

              Calendar.setup(
              {
	              inputField : "receiptDate", // ID of the input field
	              ifFormat : "%Y-%m-%d", // the date format
	              button : "imgReceiptDate", // ID of the button
	             // align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true
              }
              );

</script>

</body>
</html>